package com.iss.lxhproject.dao;
import com.iss.lxhproject.entity.Userinfo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface UserInfoDao {
    //增
    @Insert("insert into userinfo values(null,#{uInfo_name},#{uInfo_familyname},#{uInfo_gender},#{uInfo_phone})")
    Integer insertPeople(Userinfo userinfo);
    //删
    @Delete(" <script>"+"delete from userinfo where uInfo_name in" +
            "    <foreach collection=\"array\" item=\"id\" separator=\",\" open=\"(\" close=\")\">" +
            "        #{id}" +
            "    </foreach></script>")
    Integer deletePeople(String[] uInfo_names);
    //改
    @Update("update userinfo set uInfo_id=null,uInfo_familyname=#{uInfo_familyname},uInfo_gender=#{uInfo_gender},uInfo_phone=#{uInfo_phone} where uInfo_name=#{uInfo_name}")
    Integer updatePeople(Userinfo userinfo);
    //查
    @Select("select * from userinfo")
    List<Userinfo> selectAll();
    //根据id查询
    @Select("select * from userinfo where uInfo_name=#{uInfo_name}")
    Userinfo selectUserinfobyName(String uInfo_name);
}
